package com.acme.bankapp.service;

import com.acme.bankapp.domain.Bank;
import com.acme.bankapp.domain.Client;
import com.acme.bankapp.domain.accounts.Account;

import java.util.ArrayList;
import java.util.Comparator;

/**
 * Created by splash on 24.11.2014.
 */
public class BankReport {

    public static void getNbOfCustomers (Bank bank) {
        System.out.println(bank.getClientsCount());
    }

    public static void getAccountsSortedBySum (Bank bank) {
        ArrayList<Account> accounts = new ArrayList<>();

        for (Client client : bank.getClients()) {
            accounts.add(client.getAccount());
        }

        accounts.sort(Comparator.<Account>naturalOrder());

        for (Account account : accounts) {
            System.out.println(account);
        }
    }

}

